package com.itheima.dao;

import com.itheima.pojo.Book;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author 刘全
 * @date 2021/9/15
 */
@Repository
public interface BookDao {

    @Select("select * from book")
    List<Book> getAll();

    @Insert("insert into book values(#{id},#{type},#{name},#{description})")
    void save(Book b);

    @Delete("delete from book where id = #{id}")
    void move(int id);

    @Update("update book set type=#{type},name=#{name},description=#{description} where id=#{id}")
    void set(Book book);

    @Select("select * from book where name like concat('%',#{name},'%')")
    List<Book> search(String name);
}
